﻿using Microsoft.Office.Interop.Word;
using System;
using System.Diagnostics;
using System.Reflection;

internal class Class5
{
    private void method(string str, string str1)
    {
    }

    private void method1(string str, string str1)
    {
        ApplicationClass target = new ApplicationClass();
        Type type = target.GetType();
        Documents documents = target.Documents;
        Type type2 = documents.GetType();
        object obj2 = str;
        Document document = (Document) type2.InvokeMember("Open", BindingFlags.InvokeMethod, null, documents, new object[] { obj2, true, true });
        Type type3 = document.GetType();
        object obj3 = @"c:\test.ps";
        type3.InvokeMember("PrintOut", BindingFlags.InvokeMethod, null, document, new object[] { false, false, WdPrintOutRange.wdPrintAllDocument, obj3 });
        type.InvokeMember("Quit", BindingFlags.InvokeMethod, null, target, null);
        try
        {
        }
        catch
        {
        }
        foreach (Process process in Process.GetProcesses())
        {
            string str2 = process.ToString();
            int startIndex = str2.IndexOf("(") + 1;
            int index = str2.IndexOf(")");
            if (str2.Substring(startIndex, index - startIndex).ToLower().CompareTo("acrodist") == 0)
            {
                try
                {
                    process.Kill();
                }
                catch
                {
                }
                break;
            }
        }
    }
}

